package com.ctshk.rpc.order.scenic.mapper;

import com.ctshk.rpc.order.scenic.entity.AirshowOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 周億耀
 * @since 2021-06-15
 */
public interface AirshowOrderMapper extends BaseMapper<AirshowOrder> {

    @Select({
            "select sum(pay_amount) from t_airshow_order " +
                    "where (order_status = 1 or order_status = 2) " +
                    "and account_id = #{agentId}"
    })
    BigDecimal sumSaleAmount(Long agentId);

    @Select({
            "select count(id) from t_airshow_order " +
                    "where (order_status = 1 or order_status = 2) " +
                    "and account_id = #{agentId}"
    })
    Integer sumSaleOrders(Long agentId);

}
